<!-- 添加、编辑党组织 -->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>党员添加页面</title>
  <link rel="stylesheet" href="../../yl/index.css" />
  <!-- 布局样式 -->
  <link rel="stylesheet" href="../../yl/style.css" />
  <link rel="stylesheet" href="../../yl/mobile.css" />
  <link rel="stylesheet" href="../../yl/easyui.css" />
  <link rel="stylesheet" href="../../yl/icon.css" />
</head>

<body>
  <div class="easyui-navpanel" id="app" v-cloak>
    <header>
      <div class="m-toolbar">
        <div class="m-title">{{action=='Add'?'添加党员信息':action=='Modify'?'修改党员信息':''}}</div>
      </div>
    </header>
    <div class="easyui-navpanel panel-body panel-body-nobottom panel-body-noborder" style="height: 3000px"
      id="MainTable" ref="MainTable"
      :data-options="JSON.stringify({ 'TableName': 'party_member_information', 'form': 'dataForm','primary_key': 'Party_Member_SerialNumber' })">
      <div class="yl-main">
        <div class="table_titel">
          <div class="titel">党员信息</div>
        </div>
        <el-form :model="dataForm" :rules="rules" ref="formRef" :inline-message="true">
          <el-descriptions :column="1" size="large" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">党员头像</div>
              </template>
              <el-form-item>
                <el-image v-if="type" :src="photo + dataForm.Picture_URL" fit="contain"
                  style="width: 148px; height: 148px;border-radius: 5px; border: 1px solid  #ebeef5;"></el-image>
                <yl-upload v-else v-model="dataForm.Picture_URL"></yl-upload>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">党员身份证</div>
              </template>
              <el-form-item prop="ID_Card_Number" :rules="[{ required: true, validator:ID_Validity, trigger: 'blur' }]">
                <el-input :disabled="type!=''" @change="shibie" v-model="dataForm.ID_Card_Number"
                  class="borderless-input" placeholder="请输入党员身份证" />
              </el-form-item>
            </el-descriptions-item>
          </el-descriptions>
        </el-form>
        <el-form :model="dataForm1" :rules="rules" ref="formRef1" :inline-message="true">
          <el-descriptions :column="1" size="large" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">党员姓名</div>
              </template>
              <el-form-item prop="Personal_Name" :rules="[{ required: true, message: '请选择党员姓名', trigger: 'blur' }]">
                <el-input :disabled="type!='' || !is" v-model="dataForm1.Personal_Name" class="borderless-input"
                  placeholder="请输入党员姓名" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">性别</div>
              </template>
              <el-form-item prop="Gender" :rules="[{ required: true, message: '请选择性别', trigger: 'change' }]">
                <el-select :disabled="type!='' || !is" v-model="dataForm1.Gender" placeholder="请选择性别" size="large">
                  <el-option v-for="item in ['男','女']" :key="item" :label="item" :value="item" />
                </el-select>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">出生日期</div>
              </template>
              <el-form-item prop="Birthday" :rules="[{ required: true, message: '请选择出生日期', trigger: 'change' }]">
                <el-date-picker :disabled="type!='' || !is" v-model="dataForm1.Birthday" format="YYYY-MM-DD"
                value-format="YYYY-MM-DD" class="borderless-input" type="date" placeholder="请选择出生日期" size="large" />
              </el-form-item>
              
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">户籍地(省/市/区)</div>
              </template>
              <el-form-item prop="RR_City_Number" :rules="[{ required: true, message: '请选择省市区乡镇', trigger: 'change' }]">
                <el-cascader :disabled="type!='' || !is" @change="changeCity" v-model="dataForm1.RR_County_Nubmer" filterable
                class="borderless-input" :props="{value:'value',label:'label',children:'children',emitPath:false}"
                placeholder="请选择省市区乡镇" :options="city" style="width: 100%"></el-cascader>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">户籍地(乡镇/村庄)</div>
              </template>
              <el-form-item prop="RR_Village_Number" :rules="[{ required: true, message: '请选择户籍地(乡镇/村庄)', trigger: 'change' }]">
                <el-cascader :disabled="type!='' || !is" @change="changeCity1" v-model="dataForm1.RR_Village_Number" filterable
                class="borderless-input"
                :props="{value:'ProvinceNumber',label:'Province',children:'children',emitPath:false}"
                placeholder="请选择省市区乡镇" :options="city1" style="width: 100%"></el-cascader>
              </el-form-item>
            </el-descriptions-item>
            <!-- <el-descriptions-item>
              <template #label>
                <div class="cell-item">户籍地</div>
              </template>
              <el-cascader :disabled="type!='' || !is" @change="changeCity1" v-model="dataForm1.RR_Village_Number" filterable
                class="borderless-input"
                :props="{value:'ProvinceNumber',label:'Province',children:'children',emitPath:false}"
                placeholder="请选择户籍地" :options="city1" style="width: 100%"></el-cascader>
            </el-descriptions-item> -->
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">现住址</div>
              </template>
              <el-form-item prop="Home_Address"  :rules="[{ required: true, message: '请输入现住址', trigger: 'blur' }]">
                <el-input :disabled="type!='' || !is" v-model="dataForm1.Home_Address" class="borderless-input"
                placeholder="请输入现住址" />
              </el-form-item>
              
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">民族</div>
              </template>
              <el-form-item prop="Nation"  :rules="[{ required: true, message: '请选择民族', trigger: 'change' }]">
                <el-select :disabled="type!='' || !is" v-model="dataForm1.Nation" placeholder="请选择民族" size="large">
                  <el-option v-for="item in Nation" :key="item.id" :label="item.name" :value="item.name" />
                </el-select>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">联系电话</div>
              </template>
              <el-form-item prop="Contact_Phone"  :rules="[{ required: true, validator:PH_Validity, trigger: 'blur' }]">
                <el-input   :disabled="type!='' || !is"  v-model="dataForm1.Contact_Phone" class="borderless-input" placeholder="请输入联系电话" />
              </el-form-item>
            </el-descriptions-item>
          </el-descriptions>
        </el-form>
        <el-form :model="dataForm"  ref="formRef2" :inline-message="true">
          <el-descriptions :column="1" size="large" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">认领岗位</div>
              </template>
              <el-form-item prop="Party_Member_Position_SerialNumber" :rules="[{ required: true, message: '请选择认领岗位', trigger: 'change' }]">
                <el-select :disabled="type!=''" v-model="dataForm.Party_Member_Position_SerialNumber"
                  placeholder="请选择认领岗位" size="large">
                  <el-option v-for="item in Position" :key="item.value" :label="item.Party_Member_Position"
                    :value="item.Party_Member_Position_SerialNumber" />
                </el-select>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">入党日期</div>
              </template>
              <el-form-item prop="Joining_Date"  :rules="[{ required: true,  message: '请选择入党日期', trigger: 'change' }]">
                <el-date-picker :disabled="type!=''" v-model="dataForm.Joining_Date" format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD" class="borderless-input" type="date" placeholder="请选择入党日期" size="large" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">转正日期</div>
              </template>
              <el-form-item prop="Conformation_Date" :rules="[{ required: true,  message: '请选择转正日期', trigger: 'change' }]">
                <el-date-picker :disabled="type!=''" v-model="dataForm.Conformation_Date" format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD" class="borderless-input" type="date" placeholder="请选择转正日期" size="large" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">所属党组织</div>
              </template>
              <el-form-item prop="Party_Organization_SerialNumber" :rules="[{ required: true,  message: '请选择所属党组织', trigger: 'change' }]">
                <el-cascader :disabled="type!=''" v-model="dataForm.Party_Organization_SerialNumber" filterable
                  class="borderless-input"
                  :props="{value:'Party_Organization_SerialNumber',label:'Party_Organization_Name',children:'children',checkStrictly: true, emitPath: false}"
                  placeholder="请选择所属党组织" :options="Manager" style="width: 100%"></el-cascader>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">党员类型</div>
              </template>
              <el-form-item prop="Party_Member_Category_SerialNumber" :rules="[{ required: true,  message: '请选择所属党员类型', trigger: 'change' }]">
                <el-select :disabled="type!=''" v-model="dataForm.Party_Member_Category_SerialNumber"
                  placeholder="请选择所属党员类型" size="large">
                  <el-option v-for="item in Category" :key="item.Party_Member_Category_SerialNumber"
                    :label="item.Party_Member_Category" :value="item.Party_Member_Category_SerialNumber" />
                </el-select>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">备注</div>
              </template>
              <el-form-item prop="Remarks">
                <el-input :disabled="type!=''" v-model="dataForm.Remarks" class="borderless-input" placeholder="可输入备注" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">附件</div>
              </template>
              <el-form-item>
                <!-- <yl-upload ref="ylUpload" drag
                  @success="success2" @remove="remove2" :limit="99" :file="fileList"></yl-upload> -->
                <yl-upload ref="ylUpload" drag
                  @success="success2"
                  @remove="remove2"
                  @preview="preview1"
                  :limit="99" :file="fileList1"></yl-upload>
              </el-form-item>
            </el-descriptions-item>
          </el-descriptions>
        </el-form>
        <div id="ChildTable">
          <div class="table_titel" v-if="type=='1'">
            <div class="titel">成长轨迹{{childDataForm.filter(item => item.Row_Status != '1' && item.Type == '0').length ==
              0?'(暂无数据)':''}}
            </div>
            <div class="operation">
              <el-button type="primary" size="small" @click="handleAdd('0')">新增</el-button>
              <el-button type="danger" size="small" @click="handleRemove('0')">删除</el-button>
            </div>
          </div>
          <el-timeline v-if="type=='1'" :reverse="true" class="custom-timeline">
            <el-timeline-item
              v-for="(item, index) in childDataForm.filter(i => i.Row_Status != '1' && i.Type == '0' && i.Place_File == '1')"
              :key="index">
              <div style="font-size: 16px;margin-bottom: 5px;">
                {{item.Start_Date}} ~ {{item.End_Date}}
              </div>
              <div style="font-size: 16px;margin-bottom: 5px;">
                <span style="font-weight: bold;">地点:</span> {{item.Recording_Location}}
              </div>
              <el-card class="box-card" shadow="never" style="width: 500px;">
                <div>{{item.Event_Main}}</div>
              </el-card>
              <div style="font-size: 16px;margin-bottom: 5px;">
                <span style="font-weight: bold;">附件:</span>
              </div>
              <ul class="el-upload-list el-upload-list--text" style="width: 500px;">
                <li v-for="(obj,id) in item.Children.party_member_event_attachment.filter(i=>i.Row_Status !='1')"
                  class="el-upload-list__item is-success">
                  <div class="el-upload-list__item-info">
                    <a class="el-upload-list__item-name" @click="preview(obj)">
                      <el-icon>
                        <Document />
                      </el-icon>
                      <span class="el-upload-list__item-file-name">{{obj.Attachment_Name + "（磁盘文件名:" +
                        obj.Attachment_URL + "）"}}</span>
                    </a>
                  </div>
                  <label class="el-upload-list__item-status-label">
                    <el-icon class="el-icon--upload-success">
                      <Download />
                    </el-icon>
                  </label>
                  <el-icon @click="download(obj)" class="el-icon el-icon--upload-success el-icon--close">
                    <Download />
                  </el-icon>
                </li>
              </ul>
            </el-timeline-item>
          </el-timeline>
          <el-form v-if="type=='1'"
            :model="{childDataForm:childDataForm.filter(i => i.Row_Status != '1' && i.Type == '0' && i.Place_File != '1')}"
            ref="form1" :inline-message="true" style="width: 100%">
            <el-descriptions :column="3" size="large" border
              :data-options="JSON.stringify({ 'TableName': 'party_member_event', 'form': 'childDataForm', 'ParentTableName': 'party_member_information'})"
              v-for="(item , index ) in childDataForm.filter(i => i.Row_Status != '1' && i.Type == '0' && i.Place_File != '1')"
              :key="index">
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">开始时间</div>
                </template>
                <el-form-item prop="Start_Date">
                  <el-date-picker v-model="item.Start_Date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
                    class="borderless-input" type="date" placeholder="请选择时间" size="large" />
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">结束时间</div>
                </template>
                <el-form-item prop="End_Date">
                  <el-date-picker v-model="item.End_Date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
                    class="borderless-input" type="date" placeholder="请选择时间" size="large" />
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">地点</div>
                </template>
                <el-form-item prop="Recording_Location">
                  <el-input v-model="item.Recording_Location" class="borderless-input" placeholder="请输入地点" />
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item :span="3">
                <template #label>
                  <div class="cell-item">说明</div>
                </template>
                <el-form-item prop="Event_Main">
                  <el-input type="textarea" :autosize="{ minRows: 6}" v-model="item.Event_Main" class="borderless-input"
                    placeholder="请输入说明" />
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item :span="3">
                <template #label>
                  <div class="cell-item">附件</div>
                </template>
                <el-form-item>
                  <yl-upload ref="ylUpload" drag
                    @success="(row, res) => { this.success(row, res,item.Children.party_member_event_attachment,'Event_SerialNumber',item.Event_SerialNumber) }"
                    @remove="(row, res) => { this.remove(row, res,item.Children.party_member_event_attachment,'Event_SerialNumber',item.Event_SerialNumber) }"
                    :limit="99" :file="item.fileList"></yl-upload>
                </el-form-item>
              </el-descriptions-item>
            </el-descriptions>
          </el-form>
          <div class="table_titel" v-if="type=='2'">
            <div class="titel">奖惩记录{{childDataForm.filter(item => item.Row_Status != '1' && item.Type == '1').length ==
              0?'(暂无数据)':''}}
            </div>
            <div class="operation">
              <el-button type="primary" size="small" @click="handleAdd('1')">新增</el-button>
              <el-button type="danger" size="small" @click="handleRemove('1')">删除</el-button>
            </div>
          </div>
          <el-timeline v-if="type=='2'" :reverse="true" class="custom-timeline">
            <el-timeline-item
              v-for="(item, index) in childDataForm.filter(i => i.Row_Status != '1' && i.Type == '1' && i.Place_File == '1')"
              :key="index">
              <div style="font-size: 16px;margin-bottom: 5px;">
                <span style="font-weight: bold;">时间:</span> {{item.Recording_Date}}
              </div>
              <div style="font-size: 16px;margin-bottom: 5px;">
                <span style="font-weight: bold;">地点:</span> {{item.Recording_Location}}
              </div>
              <el-card class="box-card" shadow="never" style="width: 500px;">
                <div>{{item.Event_Main}}</div>
              </el-card>
              <div style="font-size: 16px;margin-bottom: 5px;">
                <span style="font-weight: bold;">附件:</span>
              </div>
              <ul class="el-upload-list el-upload-list--text" style="width: 500px;">
                <li v-for="(obj,id) in item.Children.party_member_event_attachment.filter(i=>i.Row_Status !='1')"
                  class="el-upload-list__item is-success">
                  <div class="el-upload-list__item-info">
                    <a class="el-upload-list__item-name" @click="preview(obj)">
                      <el-icon>
                        <Document />
                      </el-icon>
                      <span class="el-upload-list__item-file-name">{{obj.Attachment_Name + "（磁盘文件名:" +
                        obj.Attachment_URL + "）"}}</span>
                    </a>
                  </div>
                  <label class="el-upload-list__item-status-label">
                    <el-icon class="el-icon--upload-success">
                      <Download />
                    </el-icon>
                  </label>
                  <el-icon @click="download(obj)" class="el-icon el-icon--upload-success el-icon--close">
                    <Download />
                  </el-icon>
                </li>
              </ul>
            </el-timeline-item>
          </el-timeline>
          <el-form v-if="type=='2'"
            :model="{childDataForm:childDataForm.filter(i => i.Row_Status != '1' && i.Type == '1' && i.Place_File != '1')}"
            ref="form2" :inline-message="true" style="width: 100%">
            <el-descriptions :column="2" size="large" border
              :data-options="JSON.stringify({ 'TableName': 'party_member_event', 'form': 'childDataForm', 'ParentTableName': 'party_member_information'})"
              v-for="(item , index ) in childDataForm.filter(i => i.Row_Status != '1' && i.Type == '1' && i.Place_File != '1')"
              :key="index">
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">时间</div>
                </template>
                <el-form-item prop="Recording_Date">
                  <el-date-picker v-model="item.Recording_Date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
                    class="borderless-input" type="date" placeholder="请选择时间" size="large" />
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">地点</div>
                </template>
                <el-form-item prop="Recording_Location">
                  <el-input v-model="item.Recording_Location" class="borderless-input" placeholder="请输入地点" />
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item :span="2">
                <template #label>
                  <div class="cell-item">说明</div>
                </template>
                <el-form-item prop="Event_Main">
                  <el-input v-model="item.Event_Main" type="textarea" :autosize="{ minRows: 6}" class="borderless-input"
                    placeholder="请输入说明" />
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item :span="2">
                <template #label>
                  <div class="cell-item">附件</div>
                </template>
                <el-form-item>
                  <yl-upload ref="ylUpload" drag
                    @success="(row, res) => { this.success(row, res,item.Children.party_member_event_attachment,'Event_SerialNumber',item.Event_SerialNumber) }"
                    @remove="(row, res) => { this.remove(row, res,item.Children.party_member_event_attachment,'Event_SerialNumber',item.Event_SerialNumber) }"
                    :limit="99" :file="item.fileList"></yl-upload>
                </el-form-item>
              </el-descriptions-item>
            </el-descriptions>
          </el-form>
          <div class="table_titel" v-if="type=='3'">
            <div class="titel">承诺践诺</div>
          </div>
          <el-table v-if="type=='3'" id="table" style="margin-bottom: 20px;" border max-height="450"
            tooltip-effect="dark" :data="childDataForm1.filter(i=>i.Place_File == '1')">
            <el-table-column min-width="180" prop="Attachment_SerialNumber" label="附件流水号"></el-table-column>
            <el-table-column min-width="180" prop="File_NameOri" label="附件名称">
              <template v-slot="{row}">
                {{row.File_NameOri || row.File_Name}}
              </template>
            </el-table-column>
            <el-table-column min-width="180" prop="File_Name" label="磁盘文件名"></el-table-column>
            <el-table-column min-width="180" label="附件类型">
              <template v-slot="{row}">
                {{File_Type(row)}}
              </template>
            </el-table-column>
            <el-table-column width="200" fixed="right" align="center" label="操作">
              <template v-slot="{row}">
                <el-button type="primary" size="small" @click="preview(row)">
                  在线预览
                </el-button>
                <el-button type="success" size="small" @click="download(row)">
                  下载附件
                </el-button>
              </template>
            </el-table-column>
          </el-table>
          <el-form v-if="type=='3'" :model="{childDataForm1}" ref="form3" :inline-message="true" style="width: 100%">
            <el-descriptions
              :data-options="JSON.stringify({'TableName': 'party_member_attachment', 'form': 'childDataForm1', 'ParentTableName': 'party_member_information'})"
              :column="1" size="large" border>
              <el-descriptions-item v-for="(item,index) in party_member_attachment_type" :key="index">
                <template #label>
                  <div class="cell-item">{{item.File_Type}}</div>
                </template>
                <el-form-item>
                  <yl-upload ref="ylUpload" drag
                    @success="(row, res) => { this.success1(row, res,childDataForm1,'Party_Member_SerialNumber',dataForm.Party_Member_SerialNumber,item.File_Type_SerialNumber) }"
                    @remove="(row, res) => { this.remove1(row, res,childDataForm1,'Party_Member_SerialNumber',dataForm.Party_Member_SerialNumber,item.File_Type_SerialNumber) }"
                    @preview="preview1"
                    :limit="99" :file="fileList.filter(i => i.File_Type == item.File_Type_SerialNumber )"></yl-upload>
                </el-form-item>
              </el-descriptions-item>
            </el-descriptions>
          </el-form>
          <el-descriptions
              :data-options="JSON.stringify({'TableName': 'party_member_attachment', 'form': 'childDataForm1', 'ParentTableName': 'party_member_information'})"
          ></el-descriptions>
        </div>
      </div>
    </div>
    <footer class="botton-ann">
      <el-button @click="goBack">返回</el-button>
      <el-button type="primary" plain @click="handleSubmit" :loading="loading">提交</el-button>
    </footer>
    <yl-online-preview :file-url="fileUrl" v-model="showDialog"></yl-online-preview>
  </div>
</body>
<script src="../../utils/utils.js"></script>
<script src="../../utils/ID_Validity.js"></script>
<script src="../../config/config.js"></script>
<script src="../../utils/compressor.js"></script>
<script src="../../utils/mixins.js"></script>
<script src="../../yl/vue.js"></script>
<script src="../../yl/index.js"></script>
<script src="../../yl/zh-cn.mjs"></script>
<script src="../../yl/index.iife.min.js"></script>
<script src="../../yl/jquery.min.js"></script>
<script src="../../utils/jquery.cookie.js"></script>
<script src="../../yl/jquery.easyui.min.js"></script>
<script src="../../yl/jquery.easyui.mobile.js"></script>
<script src="../../yl/moment.min.js"></script>
<script src="../../api/request.js"></script>
<script src="./js/party_member_informationAdd.js"></script>

</html>